<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
<title>派工明细报表</title>
<%@ include file="/common/meta.jsp" %>
<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
<script type="text/javascript">
var basic_Url="${ctx}/logic/Reports";
var basic_WUrl="/logic/Reports";
var grid;
//获得表数据
$(function(){
	grid=$("#table1").ligerGrid({
			columns: [ 
			           { display: '员工姓名', name: 'zd008UseName', width: 200 },
			           { display: '车间', name: 'zd028WorkShopName', width: 200 },
			           { display: '总价', name: 'allprice', width: 200,render:function (item){
				        	  if(item.allprice==null||item.allprice==""||parseFloat(item.allprice)==0){
				        		  return '0.0';
				        	  }
				        	  return item.allprice;
				          }
			           }
			           ],
			          enabledEdit: true,
	                  usePager: false, rownumbers: true, 
	                  url:basic_Url+"/dispatchingDetailsList.do",
	                  width: "100%", height:'100%',
	                  enabledSort:false,
	                  checkbox: true, rownumbers:true,
	                  onDblClickRow : function (data, rowindex, rowobj){
	                	  var condition = generateCondition();
	                	  var usercode = data.zd007UseCode;
	                	  var workshop = data.zd028WorkShopName;
	                	  var url=basic_Url+"/collectDispatchingDetailsItem.do?usercode="+usercode+"&workshop="+workshop+"&condition="+condition;
	                	  $.dialog({id:"operate", title:data.zd008UseName+"派工明细", content:"url:"+url, width:"100%", height:"100%", min:true, max:true , lock : true}).max();
                       },
		              onSelectRow : function(item){
		            	  var data=grid.getSelectedRows();
		            		var sumNum=0;
		            		 $(data).each(function(){
		            			 if(this.zd008UseName!='1'){
			            			sumNum=sumNum+this.allprice;
		            			 }
		            		 });
		            		 sumNum=sumNum.toFixed(4);
		            		 $("#sumNum").val(sumNum);
		              },
		              onUnSelectRow : function(item){
		            	  var data=grid.getSelectedRows();
		            		var sumNum=0;
		            		 $(data).each(function(){
		            			 if(this.zd008UseName!='1'){
				            			sumNum=sumNum+this.allprice;
			            			 }
		            		 });
		            		 sumNum=sumNum.toFixed(4);
		            		 $("#sumNum").val(sumNum);
		              }
	                  });
		$("#pageloading").hide();
});
//新建搜索
function createSearch(){
	init(1, 8, '80,100,80,100,80,100,80,100','5%');
	addCommon(0,0,"lable","员工");
	addCommon(0,1, "txtlike","logic_production_dispatching_detail_item.zd008UseName");
	addCommon(0,2,"lable","起始时间");
	addCommon(0,3,"datestart","logic_production_dispatching_detail.zd008WorkDate");
	addCommon(0,4,"lable","结束时间");
	addCommon(0,5,"dateend","logic_production_dispatching_detail.zd008WorkDate");
	addCommon(0,6,"lable","车间");
	addCommon(0,7,"selectEnum","logic_production_dispatching_detail_item.zd028WorkShopName","<option></option><c:forEach items='${ws}' var='item'><option value='${item.zd002Name}'>${item.zd002Name}</option></c:forEach> ");
}
function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/dispatchingDetailsList.do");
		}
document.onkeydown=keyListener;   
function keyListener(e){   
    e = e ? e : event;  
    if(e.keyCode == 13){   
    	searchAP();
    }   
}  
function excelExport(){
	var filtersStr = generateCondition();
	var url="${ctx}/excel/collectDispatchingDetailsItemExcel.do?filters="+filtersStr+"&_search=true";
	window.open(url,"_blank");
}

</script>

</head>
<body style="padding:10px" onload="createSearch()">
  <div id="layout1">

          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
			             	 <li>共计数量：</li>
							 <li><input type="text" readonly="readonly" id='sumNum' /> </li>
			             	 <li><a class="button" onclick="excelExport();"><span>导出</span></a></li>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
</body>
</html>